package com.aw.guiguzi.net.request;

import com.aw.baselib.base.AwBaseRequest;
import com.aw.guiguzi.bean.UserInfoBean;
import com.aw.guiguzi.util.AppUserUtil;

import java.util.HashMap;

import okhttp3.RequestBody;

public class NetRequest extends AwBaseRequest {

    public static RequestBody login(String username, String pwd) {
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("username", username);
        hashMap.put("password", pwd);
        hashMap.put("captchaVerification", "");
        return getBody(hashMap);
    }

    public static RequestBody createUser(UserInfoBean bean) {
        return getBody(bean);
    }

    public static RequestBody userRoleAssign(String id) {
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("userId", id);
        hashMap.put("roleIds", new String[]{"101"}); //APP端只允许创建测试账号，暂不赋予其他权限
        return getBody(hashMap);
    }

    public static RequestBody updateUserInfo(UserInfoBean bean) {
        return getBody(bean);
    }

    public static RequestBody updatePwd(String pwd) {
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("id", AppUserUtil.getUserId());
        hashMap.put("password", pwd);
        return getBody(hashMap);
    }

    public static RequestBody updateStatus(String id, boolean isEnable) {
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("id", id);
        hashMap.put("status", isEnable ? "0" : "1");
        return getBody(hashMap);
    }

    public static RequestBody resetPwd(String id, String pwd) {
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("id", id);
        hashMap.put("password", pwd);
        return getBody(hashMap);
    }

    public static RequestBody msgCreateToSend(String id, String templateId, HashMap<String, String> content) {
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("userId", id);
        hashMap.put("userType", "2");
//        hashMap.put("content", content);
        hashMap.put("templateCode", templateId);
        hashMap.put("templateParams", content);
        return getBody(hashMap);
    }
}
